1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module sourceview.Buffer;
26 
27 private import glib.ConstructionException;
28 private import glib.ListSG;
29 private import glib.Str;
30 private import glib.c.functions;
31 private import gobject.ObjectG;
32 private import gobject.Signals;
33 private import gtk.TextBuffer;
34 private import gtk.TextIter;
35 private import gtk.TextMark;
36 private import gtk.TextTag;
37 private import gtk.TextTagTable;
38 private import sourceview.Language;
39 private import sourceview.Mark;
40 private import sourceview.StyleScheme;
41 private import sourceview.c.functions;
42 public  import sourceview.c.types;
43 private import std.algorithm;
44 
45 
46 /**
47  * Subclass of [class@Gtk.TextBuffer].
48  * 
49  * A `GtkSourceBuffer` object is the model for [class@View] widgets.
50  * It extends the [class@Gtk.TextBuffer] class by adding features useful to display
51  * and edit source code such as syntax highlighting and bracket matching.
52  * 
53  * To create a `GtkSourceBuffer` use [ctor@GtkSource.Buffer.new] or
54  * [ctor@GtkSource.Buffer.new_with_language]. The second form is just a convenience
55  * function which allows you to initially set a [class@Language]. You can also
56  * directly create a [class@View] and get its [class@Buffer] with
57  * [method@Gtk.TextView.get_buffer].
58  * 
59  * The highlighting is enabled by default, but you can disable it with
60  * [method@Buffer.set_highlight_syntax].
61  * 
62  * # Context Classes:
63  * 
64  * It is possible to retrieve some information from the syntax highlighting
65  * engine. The default context classes that are applied to regions of a
66  * `GtkSourceBuffer`:
67  * 
68  * - **comment**: the region delimits a comment;
69  * - **no-spell-check**: the region should not be spell checked;
70  * - **path**: the region delimits a path to a file;
71  * - **string**: the region delimits a string.
72  * 
73  * Custom language definition files can create their own context classes,
74  * since the functions like [method@Buffer.iter_has_context_class] take
75  * a string parameter as the context class.
76  * 
77  * `GtkSourceBuffer` provides an API to access the context classes:
78  * [method@Buffer.iter_has_context_class],
79  * [method@Buffer.get_context_classes_at_iter],
80  * [method@Buffer.iter_forward_to_context_class_toggle] and
81  * [method@Buffer.iter_backward_to_context_class_toggle].
82  * 
83  * And the [signal@GtkSource.Buffer::highlight-updated] signal permits to be notified
84  * when a context class region changes.
85  * 
86  * Each context class has also an associated [class@Gtk.TextTag] with the name
87  * `gtksourceview:context-classes:<name>`. For example to
88  * retrieve the [class@Gtk.TextTag] for the string context class, one can write:
89  * ```c
90  * GtkTextTagTable *tag_table;
91  * GtkTextTag *tag;
92  * 
93  * tag_table = gtk_text_buffer_get_tag_table (buffer);
94  * tag = gtk_text_tag_table_lookup (tag_table, "gtksourceview:context-classes:string");
95  * ```
96  * 
97  * The tag must be used for read-only purposes.
98  * 
99  * Accessing a context class via the associated [class@Gtk.TextTag] is less
100  * convenient than the `GtkSourceBuffer` API, because:
101  * 
102  * - The tag doesn't always exist, you need to listen to the
103  * [signal@Gtk.TextTagTable::tag-added] and [signal@Gtk.TextTagTable::tag-removed] signals.
104  * - Instead of the [signal@GtkSource.Buffer::highlight-updated] signal, you can listen
105  * to the [signal@Gtk.TextBuffer::apply-tag] and [signal@Gtk.TextBuffer::remove-tag] signals.
106  * 
107  * A possible use-case for accessing a context class via the associated
108  * [class@Gtk.TextTag] is to read the region but without adding a hard dependency on the
109  * GtkSourceView library (for example for a spell-checking library that wants to
110  * read the no-spell-check region).
111  */
112 public class Buffer : TextBuffer
113 {
114 	/** the main Gtk struct */
115 	protected GtkSourceBuffer* gtkSourceBuffer;
116 
117 	/** Get the main Gtk struct */
118 	public GtkSourceBuffer* getBufferStruct(bool transferOwnership = false)
119 	{
120 		if (transferOwnership)
121 			ownedRef = false;
122 		return gtkSourceBuffer;
123 	}
124 
125 	/** the main Gtk struct as a void* */
126 	protected override void* getStruct()
127 	{
128 		return cast(void*)gtkSourceBuffer;
129 	}
130 
131 	/**
132 	 * Sets our main struct and passes it to the parent class.
133 	 */
134 	public this (GtkSourceBuffer* gtkSourceBuffer, bool ownedRef = false)
135 	{
136 		this.gtkSourceBuffer = gtkSourceBuffer;
137 		super(cast(GtkTextBuffer*)gtkSourceBuffer, ownedRef);
138 	}
139 
140 
141 	/** */
142 	public static GType getType()
143 	{
144 		return gtk_source_buffer_get_type();
145 	}
146 
147 	/**
148 	 * Creates a new source buffer.
149 	 *
150 	 * Params:
151 	 *     table = a #GtkTextTagTable, or %NULL to create a new one.
152 	 *
153 	 * Returns: a new source buffer.
154 	 *
155 	 * Throws: ConstructionException GTK+ fails to create the object.
156 	 */
157 	public this(TextTagTable table)
158 	{
159 		auto __p = gtk_source_buffer_new((table is null) ? null : table.getTextTagTableStruct());
160 
161 		if(__p is null)
162 		{
163 			throw new ConstructionException("null returned by new");
164 		}
165 
166 		this(cast(GtkSourceBuffer*) __p, true);
167 	}
168 
169 	/**
170 	 * Creates a new source buffer using the highlighting patterns in `language`.
171 	 *
172 	 * This is equivalent to creating a new source buffer with
173 	 * a new tag table and then calling [method@Buffer.set_language].
174 	 *
175 	 * Params:
176 	 *     language = a #GtkSourceLanguage.
177 	 *
178 	 * Returns: a new source buffer which will highlight text
179 	 *     according to the highlighting patterns in `language`.
180 	 *
181 	 * Throws: ConstructionException GTK+ fails to create the object.
182 	 */
183 	public this(Language language)
184 	{
185 		auto __p = gtk_source_buffer_new_with_language((language is null) ? null : language.getLanguageStruct());
186 
187 		if(__p is null)
188 		{
189 			throw new ConstructionException("null returned by new_with_language");
190 		}
191 
192 		this(cast(GtkSourceBuffer*) __p, true);
193 	}
194 
195 	/**
196 	 * Moves `iter` to the position of the previous [class@Mark] of the given
197 	 * category.
198 	 *
199 	 * Returns %TRUE if `iter` was moved. If `category` is NULL, the
200 	 * previous source mark can be of any category.
201 	 *
202 	 * Params:
203 	 *     iter = an iterator.
204 	 *     category = category to search for, or %NULL
205 	 *
206 	 * Returns: whether `iter` was moved.
207 	 */
208 	public bool backwardIterToSourceMark(ref TextIter iter, string category)
209 	{
210 		return gtk_source_buffer_backward_iter_to_source_mark(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(true), Str.toStringz(category)) != 0;
211 	}
212 
213 	/**
214 	 * Changes the case of the text between the specified iterators.
215 	 *
216 	 * Since 5.4, this function will update the position of `start` and
217 	 * `end` to surround the modified text.
218 	 *
219 	 * Params:
220 	 *     caseType = how to change the case.
221 	 *     start = a #GtkTextIter.
222 	 *     end = a #GtkTextIter.
223 	 */
224 	public void changeCase(GtkSourceChangeCaseType caseType, TextIter start, TextIter end)
225 	{
226 		gtk_source_buffer_change_case(gtkSourceBuffer, caseType, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
227 	}
228 
229 	/**
230 	 * Creates a source mark in the `buffer` of category `category`.
231 	 *
232 	 * A source mark is a [class@Gtk.TextMark] but organized into categories.
233 	 * Depending on the category a pixbuf can be specified that will be displayed
234 	 * along the line of the mark.
235 	 *
236 	 * Like a [class@Gtk.TextMark], a [class@Mark] can be anonymous if the
237 	 * passed `name` is %NULL.  Also, the buffer owns the marks so you
238 	 * shouldn't unreference it.
239 	 *
240 	 * Marks always have left gravity and are moved to the beginning of
241 	 * the line when the user deletes the line they were in.
242 	 *
243 	 * Typical uses for a source mark are bookmarks, breakpoints, current
244 	 * executing instruction indication in a source file, etc..
245 	 *
246 	 * Params:
247 	 *     name = the name of the mark, or %NULL.
248 	 *     category = a string defining the mark category.
249 	 *     where = location to place the mark.
250 	 *
251 	 * Returns: a new [class@Mark], owned by the buffer.
252 	 */
253 	public Mark createSourceMark(string name, string category, TextIter where)
254 	{
255 		auto __p = gtk_source_buffer_create_source_mark(gtkSourceBuffer, Str.toStringz(name), Str.toStringz(category), (where is null) ? null : where.getTextIterStruct());
256 
257 		if(__p is null)
258 		{
259 			return null;
260 		}
261 
262 		return ObjectG.getDObject!(Mark)(cast(GtkSourceMark*) __p);
263 	}
264 
265 	/**
266 	 * Forces buffer to analyze and highlight the given area synchronously.
267 	 *
268 	 * **Note**:
269 	 *
270 	 * This is a potentially slow operation and should be used only
271 	 * when you need to make sure that some text not currently
272 	 * visible is highlighted, for instance before printing.
273 	 *
274 	 * Params:
275 	 *     start = start of the area to highlight.
276 	 *     end = end of the area to highlight.
277 	 */
278 	public void ensureHighlight(TextIter start, TextIter end)
279 	{
280 		gtk_source_buffer_ensure_highlight(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
281 	}
282 
283 	/**
284 	 * Moves `iter` to the position of the next [class@Mark] of the given
285 	 * `category`.
286 	 *
287 	 * Returns %TRUE if `iter` was moved. If `category` is NULL, the
288 	 * next source mark can be of any category.
289 	 *
290 	 * Params:
291 	 *     iter = an iterator.
292 	 *     category = category to search for, or %NULL
293 	 *
294 	 * Returns: whether `iter` was moved.
295 	 */
296 	public bool forwardIterToSourceMark(ref TextIter iter, string category)
297 	{
298 		return gtk_source_buffer_forward_iter_to_source_mark(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(true), Str.toStringz(category)) != 0;
299 	}
300 
301 	/**
302 	 * Get all defined context classes at @iter.
303 	 *
304 	 * See the [class@Buffer] description for the list of default context classes.
305 	 *
306 	 * Params:
307 	 *     iter = a #GtkTextIter.
308 	 *
309 	 * Returns: a new %NULL
310 	 *     terminated array of context class names.
311 	 *     Use g_strfreev() to free the array if it is no longer needed.
312 	 */
313 	public string[] getContextClassesAtIter(TextIter iter)
314 	{
315 		auto retStr = gtk_source_buffer_get_context_classes_at_iter(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct());
316 
317 		scope(exit) Str.freeStringArray(retStr);
318 		return Str.toStringArray(retStr);
319 	}
320 
321 	/**
322 	 * Determines whether bracket match highlighting is activated for the
323 	 * source buffer.
324 	 *
325 	 * Returns: %TRUE if the source buffer will highlight matching
326 	 *     brackets.
327 	 */
328 	public bool getHighlightMatchingBrackets()
329 	{
330 		return gtk_source_buffer_get_highlight_matching_brackets(gtkSourceBuffer) != 0;
331 	}
332 
333 	/**
334 	 * Determines whether syntax highlighting is activated in the source
335 	 * buffer.
336 	 *
337 	 * Returns: %TRUE if syntax highlighting is enabled, %FALSE otherwise.
338 	 */
339 	public bool getHighlightSyntax()
340 	{
341 		return gtk_source_buffer_get_highlight_syntax(gtkSourceBuffer) != 0;
342 	}
343 
344 	/**
345 	 * Returns: whether the @buffer has an implicit trailing newline.
346 	 */
347 	public bool getImplicitTrailingNewline()
348 	{
349 		return gtk_source_buffer_get_implicit_trailing_newline(gtkSourceBuffer) != 0;
350 	}
351 
352 	/**
353 	 * Returns the [class@Language] associated with the buffer,
354 	 * see [method@Buffer.set_language].
355 	 *
356 	 * The returned object should not be unreferenced by the user.
357 	 *
358 	 * Returns: the [class@Language] associated
359 	 *     with the buffer, or %NULL.
360 	 */
361 	public Language getLanguage()
362 	{
363 		auto __p = gtk_source_buffer_get_language(gtkSourceBuffer);
364 
365 		if(__p is null)
366 		{
367 			return null;
368 		}
369 
370 		return ObjectG.getDObject!(Language)(cast(GtkSourceLanguage*) __p);
371 	}
372 
373 	/**
374 	 * Returns the list of marks of the given category at @iter.
375 	 *
376 	 * If @category is %NULL it returns all marks at @iter.
377 	 *
378 	 * Params:
379 	 *     iter = an iterator.
380 	 *     category = category to search for, or %NULL
381 	 *
382 	 * Returns: a newly allocated #GSList.
383 	 */
384 	public ListSG getSourceMarksAtIter(TextIter iter, string category)
385 	{
386 		auto __p = gtk_source_buffer_get_source_marks_at_iter(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(category));
387 
388 		if(__p is null)
389 		{
390 			return null;
391 		}
392 
393 		return new ListSG(cast(GSList*) __p);
394 	}
395 
396 	/**
397 	 * Returns the list of marks of the given category at @line.
398 	 *
399 	 * If @category is %NULL, all marks at @line are returned.
400 	 *
401 	 * Params:
402 	 *     line = a line number.
403 	 *     category = category to search for, or %NULL
404 	 *
405 	 * Returns: a newly allocated #GSList.
406 	 */
407 	public ListSG getSourceMarksAtLine(int line, string category)
408 	{
409 		auto __p = gtk_source_buffer_get_source_marks_at_line(gtkSourceBuffer, line, Str.toStringz(category));
410 
411 		if(__p is null)
412 		{
413 			return null;
414 		}
415 
416 		return new ListSG(cast(GSList*) __p);
417 	}
418 
419 	/**
420 	 * Returns the [class@StyleScheme] associated with the buffer,
421 	 * see [method@Buffer.set_style_scheme].
422 	 *
423 	 * The returned object should not be unreferenced by the user.
424 	 *
425 	 * Returns: the [class@StyleScheme]
426 	 *     associated with the buffer, or %NULL.
427 	 */
428 	public StyleScheme getStyleScheme()
429 	{
430 		auto __p = gtk_source_buffer_get_style_scheme(gtkSourceBuffer);
431 
432 		if(__p is null)
433 		{
434 			return null;
435 		}
436 
437 		return ObjectG.getDObject!(StyleScheme)(cast(GtkSourceStyleScheme*) __p);
438 	}
439 
440 	/**
441 	 * Moves backward to the next toggle (on or off) of the context class.
442 	 *
443 	 * If no matching context class toggles are found, returns %FALSE, otherwise %TRUE.
444 	 * Does not return toggles located at @iter, only toggles after @iter. Sets
445 	 * @iter to the location of the toggle, or to the end of the buffer if no
446 	 * toggle is found.
447 	 *
448 	 * See the [class@Buffer] description for the list of default context classes.
449 	 *
450 	 * Params:
451 	 *     iter = a #GtkTextIter.
452 	 *     contextClass = the context class.
453 	 *
454 	 * Returns: whether we found a context class toggle before @iter
455 	 */
456 	public bool iterBackwardToContextClassToggle(ref TextIter iter, string contextClass)
457 	{
458 		return gtk_source_buffer_iter_backward_to_context_class_toggle(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(true), Str.toStringz(contextClass)) != 0;
459 	}
460 
461 	/**
462 	 * Moves forward to the next toggle (on or off) of the context class.
463 	 *
464 	 * If no matching context class toggles are found, returns %FALSE, otherwise %TRUE.
465 	 * Does not return toggles located at @iter, only toggles after @iter. Sets
466 	 * @iter to the location of the toggle, or to the end of the buffer if no
467 	 * toggle is found.
468 	 *
469 	 * See the [class@Buffer] description for the list of default context classes.
470 	 *
471 	 * Params:
472 	 *     iter = a #GtkTextIter.
473 	 *     contextClass = the context class.
474 	 *
475 	 * Returns: whether we found a context class toggle after @iter
476 	 */
477 	public bool iterForwardToContextClassToggle(ref TextIter iter, string contextClass)
478 	{
479 		return gtk_source_buffer_iter_forward_to_context_class_toggle(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(true), Str.toStringz(contextClass)) != 0;
480 	}
481 
482 	/**
483 	 * Check if the class @context_class is set on @iter.
484 	 *
485 	 * See the [class@Buffer] description for the list of default context classes.
486 	 *
487 	 * Params:
488 	 *     iter = a #GtkTextIter.
489 	 *     contextClass = class to search for.
490 	 *
491 	 * Returns: whether @iter has the context class.
492 	 */
493 	public bool iterHasContextClass(TextIter iter, string contextClass)
494 	{
495 		return gtk_source_buffer_iter_has_context_class(gtkSourceBuffer, (iter is null) ? null : iter.getTextIterStruct(), Str.toStringz(contextClass)) != 0;
496 	}
497 
498 	/**
499 	 * Joins the lines of text between the specified iterators.
500 	 *
501 	 * Params:
502 	 *     start = a #GtkTextIter.
503 	 *     end = a #GtkTextIter.
504 	 */
505 	public void joinLines(TextIter start, TextIter end)
506 	{
507 		gtk_source_buffer_join_lines(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct());
508 	}
509 
510 	/**
511 	 * Remove all marks of @category between @start and @end from the buffer.
512 	 *
513 	 * If @category is NULL, all marks in the range will be removed.
514 	 *
515 	 * Params:
516 	 *     start = a #GtkTextIter.
517 	 *     end = a #GtkTextIter.
518 	 *     category = category to search for, or %NULL.
519 	 */
520 	public void removeSourceMarks(TextIter start, TextIter end, string category)
521 	{
522 		gtk_source_buffer_remove_source_marks(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), Str.toStringz(category));
523 	}
524 
525 	/**
526 	 * Controls the bracket match highlighting function in the buffer.
527 	 *
528 	 * If activated, when you position your cursor over a bracket character
529 	 * (a parenthesis, a square bracket, etc.) the matching opening or
530 	 * closing bracket character will be highlighted.
531 	 *
532 	 * Params:
533 	 *     highlight = %TRUE if you want matching brackets highlighted.
534 	 */
535 	public void setHighlightMatchingBrackets(bool highlight)
536 	{
537 		gtk_source_buffer_set_highlight_matching_brackets(gtkSourceBuffer, highlight);
538 	}
539 
540 	/**
541 	 * Controls whether syntax is highlighted in the buffer.
542 	 *
543 	 * If @highlight is %TRUE, the text will be highlighted according to the syntax
544 	 * patterns specified in the [class@Language] set with [method@Buffer.set_language].
545 	 *
546 	 * If @highlight is %FALSE, syntax highlighting is disabled and all the
547 	 * [class@Gtk.TextTag] objects that have been added by the syntax highlighting engine
548 	 * are removed from the buffer.
549 	 *
550 	 * Params:
551 	 *     highlight = %TRUE to enable syntax highlighting, %FALSE to disable it.
552 	 */
553 	public void setHighlightSyntax(bool highlight)
554 	{
555 		gtk_source_buffer_set_highlight_syntax(gtkSourceBuffer, highlight);
556 	}
557 
558 	/**
559 	 * Sets whether the @buffer has an implicit trailing newline.
560 	 *
561 	 * If an explicit trailing newline is present in a [class@Gtk.TextBuffer], [class@Gtk.TextView]
562 	 * shows it as an empty line. This is generally not what the user expects.
563 	 *
564 	 * If @implicit_trailing_newline is %TRUE (the default value):
565 	 * - when a [class@FileLoader] loads the content of a file into the @buffer,
566 	 * the trailing newline (if present in the file) is not inserted into the
567 	 * @buffer.
568 	 * - when a [class@FileSaver] saves the content of the @buffer into a file, a
569 	 * trailing newline is added to the file.
570 	 *
571 	 * On the other hand, if @implicit_trailing_newline is %FALSE, the file's
572 	 * content is not modified when loaded into the @buffer, and the @buffer's
573 	 * content is not modified when saved into a file.
574 	 *
575 	 * Params:
576 	 *     implicitTrailingNewline = the new value.
577 	 */
578 	public void setImplicitTrailingNewline(bool implicitTrailingNewline)
579 	{
580 		gtk_source_buffer_set_implicit_trailing_newline(gtkSourceBuffer, implicitTrailingNewline);
581 	}
582 
583 	/**
584 	 * Associates a [class@Language] with the buffer.
585 	 *
586 	 * Note that a [class@Language] affects not only the syntax highlighting, but
587 	 * also the [context classes](./class.Buffer.html#context-classes). If you want to disable just the
588 	 * syntax highlighting, see [method@Buffer.set_highlight_syntax].
589 	 *
590 	 * The buffer holds a reference to @language.
591 	 *
592 	 * Params:
593 	 *     language = a #GtkSourceLanguage to set, or %NULL.
594 	 */
595 	public void setLanguage(Language language)
596 	{
597 		gtk_source_buffer_set_language(gtkSourceBuffer, (language is null) ? null : language.getLanguageStruct());
598 	}
599 
600 	/**
601 	 * Sets a [class@StyleScheme] to be used by the buffer and the view.
602 	 *
603 	 * Note that a [class@StyleScheme] affects not only the syntax highlighting,
604 	 * but also other [class@View] features such as highlighting the current line,
605 	 * matching brackets, the line numbers, etc.
606 	 *
607 	 * Instead of setting a %NULL @scheme, it is better to disable syntax
608 	 * highlighting with [method@Buffer.set_highlight_syntax], and setting the
609 	 * [class@StyleScheme] with the "classic" or "tango" ID, because those two
610 	 * style schemes follow more closely the GTK theme (for example for the
611 	 * background color).
612 	 *
613 	 * The buffer holds a reference to @scheme.
614 	 *
615 	 * Params:
616 	 *     scheme = a #GtkSourceStyleScheme or %NULL.
617 	 */
618 	public void setStyleScheme(StyleScheme scheme)
619 	{
620 		gtk_source_buffer_set_style_scheme(gtkSourceBuffer, (scheme is null) ? null : scheme.getStyleSchemeStruct());
621 	}
622 
623 	/**
624 	 * Sort the lines of text between the specified iterators.
625 	 *
626 	 * Params:
627 	 *     start = a #GtkTextIter.
628 	 *     end = a #GtkTextIter.
629 	 *     flags = #GtkSourceSortFlags specifying how the sort should behave
630 	 *     column = sort considering the text starting at the given column
631 	 */
632 	public void sortLines(TextIter start, TextIter end, GtkSourceSortFlags flags, int column)
633 	{
634 		gtk_source_buffer_sort_lines(gtkSourceBuffer, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct(), flags, column);
635 	}
636 
637 	/**
638 	 * @iter is set to a valid iterator pointing to the matching bracket
639 	 * if @state is %GTK_SOURCE_BRACKET_MATCH_FOUND. Otherwise @iter is
640 	 * meaningless.
641 	 *
642 	 * The signal is emitted only when the @state changes, typically when
643 	 * the cursor moves.
644 	 *
645 	 * A use-case for this signal is to show messages in a [class@Gtk.Statusbar].
646 	 *
647 	 * Params:
648 	 *     iter = if found, the location of the matching bracket.
649 	 *     state = state of bracket matching.
650 	 */
651 	gulong addOnBracketMatched(void delegate(TextIter, GtkSourceBracketMatchType, Buffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
652 	{
653 		return Signals.connect(this, "bracket-matched", dlg, connectFlags ^ ConnectFlags.SWAPPED);
654 	}
655 
656 	/**
657 	 * The "cursor-moved" signal is emitted when then insertion mark has moved.
658 	 */
659 	gulong addOnCursorMoved(void delegate(Buffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
660 	{
661 		return Signals.connect(this, "cursor-moved", dlg, connectFlags ^ ConnectFlags.SWAPPED);
662 	}
663 
664 	/**
665 	 * The ::highlight-updated signal is emitted when the syntax
666 	 * highlighting and [context classes](./class.Buffer.html#context-classes) are updated in a
667 	 * certain region of the @buffer.
668 	 *
669 	 * Params:
670 	 *     start = the start of the updated region
671 	 *     end = the end of the updated region
672 	 */
673 	gulong addOnHighlightUpdated(void delegate(TextIter, TextIter, Buffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
674 	{
675 		return Signals.connect(this, "highlight-updated", dlg, connectFlags ^ ConnectFlags.SWAPPED);
676 	}
677 
678 	/**
679 	 * The ::source-mark-updated signal is emitted each time
680 	 * a mark is added to, moved or removed from the @buffer.
681 	 *
682 	 * Params:
683 	 *     mark = the [class@Mark]
684 	 */
685 	gulong addOnSourceMarkUpdated(void delegate(TextMark, Buffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
686 	{
687 		return Signals.connect(this, "source-mark-updated", dlg, connectFlags ^ ConnectFlags.SWAPPED);
688 	}
689 }